<?php
	require_once '../../controller/lotacoescontrato/' . basename(__FILE__);
	$pagina[0] = array('Contratos', '../../view/contratos/pesquisar.php');
	$pagina[1] = array('Editar Contrato', '../../view/contratos/cadastrar.php?id=' . $_GET['contratoid'] );
	$pagina[2] = array('Lotações');
    require_once '../../template/header.php';
?>
<ul class="navmenu">
	<li><a class="voltar" href="../contratos/cadastrar.php?id=<?php echo $_GET['contratoid'] ?>">Voltar</a></li>
	<?php require_once '../contratos/helper_abas.php'; ?>
</ul>
<div id="conteudo">
<?php TMensagens::exibirStatus($erro, $sucesso, $info) ?>
<?php require_once '../contratos/helper_brevidade.php' ?>
<?php SInfoContrato::gerarCabecalho($contrato) ?>
<?php require_once '../contratos/helper_situacao.php'; ?>


<?php //if ( $usuario->isAuthorized( Operacao::CONTRATO_CADASTRAR_LOTACOES ) AND ( $contrato->statusid == Status::Contrato_CadastroFinalizado OR $contrato->statusid == Status::Contrato_CadastroRecusado ) ): ?>
<?php if ($readOnly == ''): ?>
    <form method="post" action="<?php echo basename(__FILE__) . '?contratoid=' . $_GET['contratoid'] ?>" >
        <h3>Adicionar Lotação</h3>
        <dl>
            <dt>Lotação</dt>
            <dd>
            	<div id="autocomplete">
                	<select name="ddlLotacaoID" class="autocomplete">
                        <?php TSelect::MontaDropDownList($lista, $objeto->lotacaoid, 'id', 'fantasia', ''); ?>
                	</select>
            	</div>
            </dd>
        </dl>
        <p class="botoeira">
    		<input type="submit" name="btnAcao" title="Salvar" value="Salvar" />&nbsp;
		</p>
    </form>
    <form method="post" action="<?php echo basename(__FILE__) . '?contratoid=' . $_GET['contratoid'] ?>" >
		<input type="submit" name="btnAcao" title="Excluir" value="Excluir" onclick="javascript: return confirm('Deseja realmente excluir os itens selecionados?');"/>&nbsp;
<?php   $d = new TDataTableContratoLotacao($contratoid,array('editColumn'=> FALSE, 'itensPerPage' => 30));
	    echo $d->render(); ?>
    </form>
<?php else: ?>
<?php     $d = new TDataTableContratoLotacao($contratoid,array('editColumn'=> FALSE,'checkColumn'=> FALSE, 'itensPerPage', 30));
	      echo $d->render(); ?>
<?php endif; ?>
</div>
<?php require_once ('../../template/footer.php'); ?>